//
//  HomeItemCell.m
//  ZZmetro
//
//  Created by 一介布衣 on 2020/6/11.
//  Copyright © 2020 一介布衣. All rights reserved.
//

#import "HomeItemCell.h"

@implementation HomeItemCell

- (id)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        
        //单元格的宽度
        CGFloat cellWidth = SCREEN_WIDTH / 4.0 - 1;
        
        CGFloat imageViewWidth = cellWidth;
        CGFloat imageViewHeight = cellWidth;
        CGFloat imageViewTopView = 0;
        
        /// 1.添加ImageView
        self.imageView = [[UIImageView alloc] initWithFrame: CGRectMake(0, imageViewTopView, imageViewWidth, imageViewHeight)];
        
        [self addSubview:self.imageView];
        
        /// 2.添加标签
        CGFloat labelWidth = cellWidth;
        CGFloat labelHeight = 16;
        CGFloat labelTopView = cellWidth;
        self.label = [[UILabel alloc] initWithFrame:CGRectMake(0, labelTopView, labelWidth, labelHeight)];
        //字体左右居中
        self.label.textAlignment = NSTextAlignmentCenter;
        //设置字体
        self.label.font = [UIFont systemFontOfSize:13];
        //self.backgroundColor =[UIColor redColor];
        [self addSubview:self.label];
        
        //NSLog([NSString stringWithFormat:@"cell height:%i", self.frame.size.width]);
        
    }
    return self;
}
@end
